<%= render Settings::H1Component.new do %>
  Share & Save
<% end %>

<% if @active_sharing_services.present? %>
  <div class="mb-14">
    <%= render Settings::H2Component.new do %>
      Active Services
    <% end %>

    <% @active_sharing_services.each do |sharing_service| %>
      <%= render sharing_service %>
    <% end %>
  </div>
<% end %>

<% unless @active_sharing_services.count == @available_sharing_services.count %>
  <div class="mb-14">
    <%= render Settings::H2Component.new do %>
      Available Services
    <% end %>

    <% @available_sharing_services.each do |sharing_service| %>
      <% unless @active_service_ids.include?(sharing_service.service_id) %>
        <%= render partial: "supported_sharing_services/service_#{sharing_service.service_id}", locals: {sharing_service: sharing_service, record: SupportedSharingService.new, status: :inactive} %>
      <% end %>
    <% end %>
  </div>
<% end %>

<%= render Settings::ControlGroupComponent.new class: "group", data: {capsule: "true"} do |group| %>
  <% group.header do %>
    Custom Services
  <% end %>
  <% group.item do %>
    <%= render "form", record: @sharing_service %>
  <% end %>
<% end %>